Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>PC Screen Font</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/PC_Screen_Font"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-PC_Screen_Font rootpage-PC_Screen_Font skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">PC Screen Font</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><p><b>PC Screen Font</b> (<b>PSF</b>) is a <a href="Computer_font#BITMAP" title="Computer font">bitmap font</a> format currently employed by the <a href="Linux_kernel" title="Linux kernel">Linux kernel</a> for <a href="Linux_console" title="Linux console">console</a> fonts. Documentation of the PSF file format can be found within the source code of the Linux kbd utilities.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> The format is described by the University Eindhoven.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="File_format">File format</h2></div>
<div class="mw-heading mw-heading3"><h3 id="File_header">File header</h3></div>
<p>Every PSF file begins with a header. There are two header types: PSF1 and PSF2. All multibyte integers are in least significant byte order (little endian).
</p>
<table class="wikitable">
<caption>psf1 header
</caption>
<tbody><tr>
<th>Length</th>
<th>Description</th>
<th>Notes
</th></tr>
<tr>
<td>2</td>
<td>Magic bytes</td>
<td>Always <code>36 04</code>
</td></tr>
<tr>
<td>1</td>
<td>PSF Font mode</td>
<td>Various font flags, see <a href="#Font_modes">font modes</a>
</td></tr>
<tr>
<td>1</td>
<td>Glyph size</td>
<td>Glyph size in bytes, 8 bit unsigned integer. For psf1, the character size always equals the glyph height
</td></tr></tbody></table>
<table class="wikitable">
<caption>psf2 header
</caption>
<tbody><tr>
<th>Length</th>
<th>Description</th>
<th>Notes
</th></tr>
<tr>
<td>4</td>
<td>Magic bytes</td>
<td>Always <code>72 b5 4a 86</code>
</td></tr>
<tr>
<td>4</td>
<td>Version</td>
<td>32 bit unsigned integer, currently always 0
</td></tr>
<tr>
<td>4</td>
<td>Header Size</td>
<td>32 bit unsigned integer, size of the header in bytes (usually 32)
</td></tr>
<tr>
<td>4</td>
<td>Flags</td>
<td>32 bit unsigned integer, see <a href="#Font_flags">Font flags</a>
</td></tr>
<tr>
<td>4</td>
<td>Length</td>
<td>32 bit unsigned integer, number of glyphs
</td></tr>
<tr>
<td>4</td>
<td>Glyph size</td>
<td>32 bit unsigned integer, number of bytes per glyph
</td></tr>
<tr>
<td>4</td>
<td>Height</td>
<td>32 bit unsigned integer, height of each glyph
</td></tr>
<tr>
<td>4</td>
<td>Width</td>
<td>32 bit unsigned integer, width of each glyph
</td></tr></tbody></table>
<p>All psf1 glyphs are 8 pixels wide.
</p>
<div class="mw-heading mw-heading4"><h4 id="Font_modes">Font modes</h4></div>
<p>The font mode in a psf1 header is an 8 bit unsigned integer containing various flags about the font
</p>
<table class="wikitable">
<caption>Font mode bits
</caption>
<tbody><tr>
<th>Value (<a href="Hexadecimal" title="Hexadecimal">hex</a>)</th>
<th>Name</th>
<th>Meaning
</th></tr>
<tr>
<td><code>0x01</code></td>
<td>PSF1_MODE512</td>
<td>If this bit is set, the font face will have 512 glyphs. If it is unset, then the font face will have just 256 glyphs.
</td></tr>
<tr>
<td><code>0x02</code></td>
<td>PSF1_MODEHASTAB</td>
<td>If this bit is set, the font face will have a <a href="Unicode" title="Unicode">unicode</a> table.
</td></tr>
<tr>
<td><code>0x04</code></td>
<td>PSF1_MODESEQ</td>
<td>Equivalent to PSF1_MODEHASTAB
</td></tr></tbody></table>
<div class="mw-heading mw-heading4"><h4 id="Font_flags">Font flags</h4></div>
<p>The font flags field in a psf2 header is a 32 bit unsigned integer containing various flags about the font. There is currently only one flag.
</p>
<table class="wikitable">
<caption>Font flag bits
</caption>
<tbody><tr>
<th>Value (hex)</th>
<th>Name</th>
<th>Meaning
</th></tr>
<tr>
<td>0x00000001</td>
<td>PSF2_HAS_UNICODE_TABLE</td>
<td>If this bit is set, the font face will have a unicode table
</td></tr></tbody></table>
<div class="mw-heading mw-heading3"><h3 id="File_bitmaps">File bitmaps</h3></div>
<p>The actual glyph data immediately follows the header. Each bit in each glyph represents one pixel in the font: 0 for undrawn, 1 for drawn. Each row of each glyph is padded to a whole number of bytes. For example, a 12x12 font would have 2 bytes per row. The letter 'A' in a 12x12 PSF bitmap may look like this:
</p>
<pre> padding
Font data |
+----------+ +--+
000001100000 0000
000011110000 0000
000110011000 0000
001100001100 0000
011000000110 0000
110000000011 0000
111111111111 0000
111111111111 0000
110000000011 0000
110000000011 0000
110000000011 0000
110000000011 0000
</pre>
<p>with twelve bits of actual data and padding to fill each row to the nearest byte. Rows are stored left-most column first.
</p>
<div class="mw-heading mw-heading3"><h3 id="The_unicode_table">The unicode table</h3></div>
<p>If a PSF file contains a unicode table, then every glyph has an entry in the unicode table, with the first glyph corresponding to the first entry in the table, the second glyph the second entry, and so on. The format of an entry in the unicode table depends on the type of the PSF header.
</p>
<div class="mw-heading mw-heading4"><h4 id="The_PSF1_unicode_table">The PSF1 unicode table</h4></div>
<p>Entries in the unicode table of a PSF1 file are represented as a series of 16 bit little-endian unsigned integers ending in 0xffff. The first integers in the entry contain a unicode character represented by the corresponding glyph. These unicode characters continue until the integer 0xFFFE is encountered. Then, starting from the 0xfffe value, rather than representing individual unicode characters, the numbers represent series of unicode characters that correspond to the glyph, starting a new series with every 0xfffe encountered, and stopping once 0xffff is encountered. For example, the following series of 16 bit little-endian unsigned integers would be interpreted in the following way:
</p>
<pre>0xdead
0xbeef

0xfffe
0x3141
0x5926

0xfffe
0x1234
0x5678

0xffff
</pre>
<p>Whenever either U+dead, U+beef, the sequence U+3141 U+5926, or the sequence U+1234 U+5678 is seen, display the glyph corresponding to this unicode table entry.
</p>
<div class="mw-heading mw-heading4"><h4 id="The_PSF2_unicode_table">The PSF2 unicode table</h4></div>
<p>Entries in the unicode table of a PSF2 file are the same as those in a PSF1 file, except unicode characters are represented in UTF-8, unicode sequences begin with the one byte 0xfe (rather than the two byte value 0xfffe), and unicode entries end with the one byte 0xff (rather than the two byte value 0xffff). Neither the values 0xfe nor 0xff can occur in valid UTF-8 sequences.
</p>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}


/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end https://en.wikipedia.org/ */
</style><cite id="CITEREFthe_Linux_Kernel_Organization2007" class="citation web cs1">the Linux Kernel Organization (2007-01-28). <a rel="nofollow" class="external text" href="https://git.kernel.org/cgit/linux/kernel/git/legion/kbd.git/tree/src/psf.h?id=82dd58358bd341f8ad71155a53a561cf311ac974">"psf.h"</a>.</cite></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><cite id="CITEREFTUE1999" class="citation web cs1">TUE (1999). <a rel="nofollow" class="external text" href="http://www.win.tue.nl/~aeb/linux/kbd/font-formats-1.html">"psf format"</a>.</cite></span>
</li>
</ol></div></div>
<style data-mw-deduplicate="TemplateStyles:r1271159938">
/* start https://en.wikipedia.org/ */


.mw-parser-output .asbox{position:relative;overflow:hidden}.mw-parser-output .asbox table{background:transparent}.mw-parser-output .asbox p{margin:0}.mw-parser-output .asbox p+p{margin-top:0.25em}.mw-parser-output .asbox-body{font-style:italic}.mw-parser-output .asbox-note{font-size:smaller}.mw-parser-output .asbox .navbar{position:absolute;top:-0.75em;right:1em;display:none}.mw-parser-output :not(p):not(.asbox)+style+.asbox,.mw-parser-output :not(p):not(.asbox)+link+.asbox{margin-top:3em}


/* end https://en.wikipedia.org/ */
</style>
</div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-06-20" href="https://en.wikipedia.org/wiki/?title=PC_Screen_Font&amp;oldid=1296550758">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>

</body></html>